<h1>
	ATSI
	<?if(!empty($_SESSION['user']['allow_add'])) { ?>
		<p class="extra-link"> 
			<a href="javascript:void(0)" class="editBtn" id="editBtn" onClick="openEditDialog('<?=$add?>')"> Create New ATSI</a>
		</p>
	<? } ?>
</h1>
<div id="search" class="singleline">
	<form id="searchForm" name="searchForm" method="POST" action="<?=$_SERVER['REQUEST_URI']?>">
		<a href="javascript:void(0)" class="reset" id="reset" onclick="resetForm('searchForm')">
			<div class="reset-filters">Reset filters</div>
		</a>
		<div class="search_filter">
			<p>
				Search by: <input type="text" name="keyword" id="keyword" value="<?=$_POST['keyword']?>">
				<input type="submit" value="Submit" class="btn">
			</p>
		</div>
		<div class="search_checks">
			<input type="checkbox" name="inactive" value="1" <?=($_POST['inactive'] == 1)?'checked':''?> > Include inactive ATSI
		</div>
	</form>
</div>

<table id="tablelist" cellspacing="0">
	<tr>
		<th style="width:50px">ID</th>
		<th style="width:300px">Label</th>
		<th style="width:100px">Status</th>
		<th style="width:33px">&nbsp;</th>
	</tr>

	<?php if($cntrows > 0){ ?>
		<?php while($row = $listObj->fetchAssoc()) {?>
			<tr class="no-border">
				<td class="center"><?=$row['id']?></td>
				<td><?=$row['label']?></td>
				<td class="center"><?=($row['active']) ? 'Active' : 'Inactive';?></td>
				<td>
					<?php
						$editParams = array(
							'url' 		  => APP_ROOT.'/edit-atsi&id='.$row['id'], 
							'titleHead'   => 'Edit - '.$row['label'], 
							'widthParam'  => 400, 
							'heightParam' => 200, 
							'postid' 	  => $row['id'], 
							'redirecturl' => APP_ROOT.'/atsi'
						);
						$edit = htmlentities(json_encode($editParams));
					?>
					<?if(!empty($_SESSION['user']['allow_edit'])) { ?>
						<a href="javascript:void(0)" class="editBtn" id="editBtn" onClick="openEditDialog('<?=$edit?>')" />
							<p class="icon_edit" title="Edit">&nbsp;</p>
						</a>
					<? } ?>
					<?if(!empty($_SESSION['user']['allow_delete'])) { ?>
						<a href="javascript:void(0)" class="deleteBtn" id="deleteBtn" onClick="openDeleteDialog('<?=APP_ROOT?>/delete-atsi&id=<?=$row['id']?>','<?=$row['id']?>')" />
							<p class="icon_delete" title="Delete">&nbsp;</p>
						</a>
					<? } ?>
				</td>
			</tr>
		<?php } //end of loop ?>
	<?php } //end of count check ?>
</table>

<!-- Pagination Links -->
<?php if($cntrows > 0){ ?>
	<div id="pagination">
		<?php echo $listObj->getPageNavStyled("atsi"); ?>
	</div>
<? } else {?>
	<div id="pagination"><p>No results found</p></div>
<? } ?>
<br clear="all">

<!-- Dialog box pop-ups -->
<div id="editDiv" title="Update Details" style="display:none;">
    <iframe id="edit" width="350" height="130" style="overflow:hidden" seamless="seamless" scrolling="no"></iframe>
</div>